Column 5 is a layout dxl I created. All I want to do is duplicate column 5 into the layout dxl column in which the below code will be pasted. Seems like this outta work, but nogo. I need the column 5 text to be in a string because what I'm eventually going to do is check to see if another string appears within the column 5 string.
Object o=obj
string colTxt
Column c = column 5
colTxt=text(c,o)
display colTxt
Any help? This seems like it should be easy. I'm using 9.2
MB
moheganburner - Wed Dec 15 18:16:42 EST 2010 |
|
Re: Duplicating one layout dxl column into another layout dxl column Peter_Albert - Thu Dec 16 05:01:03 EST 2010
Well, I am not sure whether accessing the text of one layout DXL column from within another column works at all, given the dynamic nature of layout DXL itself. Even if it was possible, I doubt it was effective, given that layout DXL updates several times when you just look at an object.
I would suggest to change the "Column 5" layout DXL into attribute DXL, which you then can easily access from another layout DXL.
Just a side comment: You don't have to "Object o=obj", as you can use "obj" directly.
Regards,
Peter
|
|
Re: Duplicating one layout dxl column into another layout dxl column iannacones1 - Thu Dec 16 09:12:13 EST 2010
To get the Layout DXL from column 5:
string colTxt = dxl(column 5)
To set it in another column:
dxl(column 6, colTxt)
|
|
Re: Duplicating one layout dxl column into another layout dxl column Peter_Albert - Thu Dec 16 09:39:45 EST 2010 iannacones1 - Thu Dec 16 09:12:13 EST 2010
To get the Layout DXL from column 5:
string colTxt = dxl(column 5)
To set it in another column:
dxl(column 6, colTxt)
These are the commands for getting setting the DXL code. If I am not wrong, the OP was interested in the DXL result, i.e. what is displayed in the Module window's column.
Regards,
Peter
|
|
Re: Duplicating one layout dxl column into another layout dxl column moheganburnerjr - Thu Dec 16 13:19:20 EST 2010
Thats correct. I was hoping to create a string of the OUTPUT of the dxl code, not the actual code. I can't believe that it is not possible to do this. I use the analysis wizard to create a layout dxl column showing all outlinks, but I can't have it save those same outlinks to a string??? I have also attempted to convert the layout dxl to an attribute, using:
string newDisplayRich = "void displayRich (string s) { obj.attrDXLName = richText s }"
Column c = column 4 // my DXL Layout
string oldCode = dxl c
print newDisplayRich "\n" oldCode
that I found in another thread, but I'm not sure where to even paste the resulting "attribute" code. If I paste it into a layout dxl column, the column will still be layout dxl.
ps, I am the OP. For some reason, I couldn't log back into my account, so I had to create a "jr" account, hence the slightly different name.
|
|
Re: Duplicating one layout dxl column into another layout dxl column kbmurphy - Thu Dec 16 14:23:37 EST 2010 moheganburnerjr - Thu Dec 16 13:19:20 EST 2010
Thats correct. I was hoping to create a string of the OUTPUT of the dxl code, not the actual code. I can't believe that it is not possible to do this. I use the analysis wizard to create a layout dxl column showing all outlinks, but I can't have it save those same outlinks to a string??? I have also attempted to convert the layout dxl to an attribute, using:
string newDisplayRich = "void displayRich (string s) { obj.attrDXLName = richText s }"
Column c = column 4 // my DXL Layout
string oldCode = dxl c
print newDisplayRich "\n" oldCode
that I found in another thread, but I'm not sure where to even paste the resulting "attribute" code. If I paste it into a layout dxl column, the column will still be layout dxl.
ps, I am the OP. For some reason, I couldn't log back into my account, so I had to create a "jr" account, hence the slightly different name.
Am I missing something?? This seems extremely simple.
//CODE BEGIN
Column c = column 5
string s = text(c, obj)
display s
//CODE END
I can't preview this in Safari, so I apologize if the formatting is messed up.
|
|
Re: Duplicating one layout dxl column into another layout dxl column moheganburnerjr - Thu Dec 16 15:33:23 EST 2010
KB, that's exactly what I thought would work (the code in my OP is the same as yours, except I have a lot of extra declarations). Your/my code only works when column 5 is an attribute. I have no idea why it doesn't also work for layout dxl columns.
|
|
Re: Duplicating one layout dxl column into another layout dxl column Mathias Mamsch - Thu Dec 16 16:18:38 EST 2010 moheganburnerjr - Thu Dec 16 15:33:23 EST 2010
KB, that's exactly what I thought would work (the code in my OP is the same as yours, except I have a lot of extra declarations). Your/my code only works when column 5 is an attribute. I have no idea why it doesn't also work for layout dxl columns.
This is interesting. After the call to "text (column 1, obj)" display does not work anymore.
string s = text(column 1, obj)
display "Hello"
does also not work, if column 1 is a DXL layout column. This looks very much like a DOORS bug (a global variable for the current column being reset after a call to text, therefore display failing).
Do you really need this? I am pretty sure, there are some more complex ways to work around this issue, i guess, but maybe you can just recalculate the value of your DXL layout column.
Regards, Mathias
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
|
Re: Duplicating one layout dxl column into another layout dxl column kbmurphy - Thu Dec 16 17:36:32 EST 2010 moheganburnerjr - Thu Dec 16 15:33:23 EST 2010
KB, that's exactly what I thought would work (the code in my OP is the same as yours, except I have a lot of extra declarations). Your/my code only works when column 5 is an attribute. I have no idea why it doesn't also work for layout dxl columns.
Wish I could tell you I was that stupid--I tested this out on what I thought was a DXL layout column before posting it. And it worked. But of course I try it again and DOORS just exited on me.
Maybe I got lucky the first time, or maybe I made a mistake and chose a bad column. Hmph. Anyhow, sorry for wasting everyone's time. :/
The work around is to use the same DXL code from the DXL column, but modify it so that it displays the text you want. Yes it shouldn't have to be this way, but that's what I'd do.
|
|
Re: Duplicating one layout dxl column into another layout dxl column Bob_Swan - Fri Dec 17 03:29:52 EST 2010
You could have a string attribute that column 5 writes to, and column 6 displays.
The drawback is that the attribute contents are only valid where column 5 is on the screen.
(So if you started with the attribute empty, open the view, change to another view, and look at the attribute values you will find only the first few are populated.)
If the data you are looking at is fairly static it at least gets the values for you to look at.
|
|
Re: Duplicating one layout dxl column into another layout dxl column Peter_Albert - Fri Dec 17 05:11:58 EST 2010 moheganburnerjr - Thu Dec 16 13:19:20 EST 2010
Thats correct. I was hoping to create a string of the OUTPUT of the dxl code, not the actual code. I can't believe that it is not possible to do this. I use the analysis wizard to create a layout dxl column showing all outlinks, but I can't have it save those same outlinks to a string??? I have also attempted to convert the layout dxl to an attribute, using:
string newDisplayRich = "void displayRich (string s) { obj.attrDXLName = richText s }"
Column c = column 4 // my DXL Layout
string oldCode = dxl c
print newDisplayRich "\n" oldCode
that I found in another thread, but I'm not sure where to even paste the resulting "attribute" code. If I paste it into a layout dxl column, the column will still be layout dxl.
ps, I am the OP. For some reason, I couldn't log back into my account, so I had to create a "jr" account, hence the slightly different name.
This is how you create an attribute DXL from a layout DXL:
Open the view with the layout DXL column (in your example column 5). Make sure the column has a good title (in your example, I think "outlinks" would be appropriate).
Ensure that you have the module open in exclusive edit
Select "Tools --> Support tools --> Convert layout DXL to attribute DXL"
In the new dialogue box, select the "outlink" column (or however you have named it) and click "OK"
You will see a new column which displays the new attribute "DXL for outlinks"
You can now remove your original layout DXL column
Then, create a new layout DXL column. In this column, you can get the string output of your former layout DXL column, which is now contained in the new attribute with
string s = probeAttr_(obj, "DXL for outlinks)"
You can then use this string to do all the search you want, and display the final result.
Now, one big difference you must keep in mind: The layout DXL updates immediately, so any change which affects the results (in your case I guess the creation / deletion of a link) is immediately reflected on the screen.
The attribute DXL is different: It is only updated at special occasions, e.g. when you open the module, or change from read-edit to exclusive or shared edit, if you unlock a section, or press F5, or select "Tools --> Refresh DXL attributes", or if you set all attribute values to null. However, you don't have to bother about your new layout DXL (which does the search). It will update automatically when the attribute DXL is updated.
Hope that helps,
Peter
P.S.: As a general rule for attribute DXL, if the resulting string is null, the attribute DXL code should routinely set the attribute value to " " to avoid re-calculation over and over again. I don't know if the automatically generated code does this or not. It is not overly important, though, if you give the above steps a try, as it will wotrk in any case, but once it works and you fell familiar with it, you could check the attribute DXL code.
|
|
Re: Duplicating one layout dxl column into another layout dxl column Peter_Albert - Fri Dec 17 05:16:38 EST 2010 Peter_Albert - Fri Dec 17 05:11:58 EST 2010
This is how you create an attribute DXL from a layout DXL:
Open the view with the layout DXL column (in your example column 5). Make sure the column has a good title (in your example, I think "outlinks" would be appropriate).
Ensure that you have the module open in exclusive edit
Select "Tools --> Support tools --> Convert layout DXL to attribute DXL"
In the new dialogue box, select the "outlink" column (or however you have named it) and click "OK"
You will see a new column which displays the new attribute "DXL for outlinks"
You can now remove your original layout DXL column
Then, create a new layout DXL column. In this column, you can get the string output of your former layout DXL column, which is now contained in the new attribute with
string s = probeAttr_(obj, "DXL for outlinks)"
You can then use this string to do all the search you want, and display the final result.
Now, one big difference you must keep in mind: The layout DXL updates immediately, so any change which affects the results (in your case I guess the creation / deletion of a link) is immediately reflected on the screen.
The attribute DXL is different: It is only updated at special occasions, e.g. when you open the module, or change from read-edit to exclusive or shared edit, if you unlock a section, or press F5, or select "Tools --> Refresh DXL attributes", or if you set all attribute values to null. However, you don't have to bother about your new layout DXL (which does the search). It will update automatically when the attribute DXL is updated.
Hope that helps,
Peter
P.S.: As a general rule for attribute DXL, if the resulting string is null, the attribute DXL code should routinely set the attribute value to " " to avoid re-calculation over and over again. I don't know if the automatically generated code does this or not. It is not overly important, though, if you give the above steps a try, as it will wotrk in any case, but once it works and you fell familiar with it, you could check the attribute DXL code.
Update: I just checked, and actually the attribute DXL code generated by DOORS adds a carriage return to each string, so the attribute value is never null. You can hence ignore that comment.
Update 2: The correct DXL fragment is of course
string s = probeAttr_(obj, "DXL for outlinks")
Regards,
Peter
|
|
Re: Duplicating one layout dxl column into another layout dxl column moheganburnerjr - Fri Dec 17 12:00:04 EST 2010
Peter, Thanks for the "Layout-to-Attribute for Dummies" tutorial. I'm definitely going to save that one!
Mathias/kb, How can I recalculate the below dxl to 'display' the result?
pragma runLim, 0
int lines[1] = {0}
void adjustLines(int depth, showAtDepth) {
int count
for (count = 0; count < 1; count++) {
while (lines[depth-1] < lines[count]) {
lines[depth-1]++
}
}
}
void showOut(Object o, int depth) {
Link l
LinkRef lr
ModName_ otherMod = null
Module linkMod = null
ModuleVersion otherVersion = null
Object othero
string disp = null
string s = null
string plain, plainDisp
int plainTextLen
int count
bool doneOne = false
string linkModName = "*"
for l in all(o->linkModName) do {
otherVersion = targetVersion l
otherMod = module(otherVersion)
if (null otherMod || isDeleted otherMod) continue
othero = target l
if (null othero) {
load(otherVersion,false)
}
othero = target l
if (null othero) continue
if (isDeleted othero) continue
int oldLines = lines[depth-1]
adjustLines(depth, 1)
bool kick = (doneOne) && (lines[depth-1] == oldLines)
if (kick) {
lines[depth-1]++
}
if (depth < 1) {
showOut(othero, depth+1)
}
doneOne = true
if (depth == 1) {
s = (identifier othero)
if (!null s)
{
displayRich("\\pard " s)
}
}
lines[depth-1] += 1
}
if (depth == 1) {
ExternalLink extLink
doneOne = false
for extLink in o->"" do {
if (!doneOne) {
displayRich("\\pard " "{\\b External Links:}")
doneOne = true
}
s = richText description(extLink)
if (!null s)
{
displayRich("\\pard " s)
}
}
}
}
showOut(obj,1)
|
|
Re: Duplicating one layout dxl column into another layout dxl column moheganburnerjr - Tue Dec 21 09:09:50 EST 2010
It sounded like you guys knew a way to recalculate the result (of the above dxl code) so I can 'display' it. Can anyone help me with that?
|
|
Re: Duplicating one layout dxl column into another layout dxl column Mathias Mamsch - Tue Dec 21 10:42:15 EST 2010 moheganburnerjr - Tue Dec 21 09:09:50 EST 2010
It sounded like you guys knew a way to recalculate the result (of the above dxl code) so I can 'display' it. Can anyone help me with that?
With "recalculate" I meant you should paste the same DXL layout code to the other column.
If that does not work, because you do not know the code of the DXL layout at runtime - I used the below code to get the column value of another column, by getting the DXL layout code from the column, and executing it on some other object and at the same time intercept the displayXY calls in the code and write the results to a buffer. This will also enable you to get the value of a DXL layout column for an object in another module (or baseline), even if you have that column not displayed in the module.
Hope that helps, regards, Mathias
Buffer gbColumnValue = create()
string prefCode;
prefCode = "
Buffer bres = addr_ " ((addr_ gbColumnValue ) int) "\n
setempty bres
void displayRich (string x) { bres += x }
void display (string x) { bres += x }
void display (Attr__ x) { Buffer c = create(); c = x; bres += c; delete c; }
void displayRichWithColour (string x) { bres += x }
void displayRichWithColor (string x) { bres += x }
"
bool getColumnValue (Object o, Column c, Buffer result) {
if (main c) return false
if (attrName c == "" ) {
Buffer code = create();
code += "Object obj = addr_ " ((addr_ o) int) "\n"
code += prefCode; code += dxl c
noError(); eval_ tempStringOf code;
string errMsg = lastError()
delete code
result = tempStringOf gbColumnValue
} else {
result = (probeAttr_ (o, attrName c)) string
}
return true
}
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
|
Re: Duplicating one layout dxl column into another layout dxl column moheganburnerjr - Tue Dec 21 17:14:08 EST 2010
How can you read the code of a layout dxl that is not displayed? Not displaying would mean you are in a view that does not include it, correct? I know you can read attributes that aren't displayed, but how wcould you refer to a layout dxl column without knowing where it is?
I can't get your sample code to work. In your code, you define column c as an attribute, so by default how could it read a layout?
I think I'm in over my head on this one...
|
|